{include file='common/_meta_layui_256' /}
<body>
<style type="text/css">
</style>
<div class="container">
    <a href="">刷新</a>
    <div id="test1"></div>
    <form class="layui-form" action="" lay-filter="form-filter" id="form-article">
        <div class="layui-row">
            <div class="layui-form-item">
                <label class="layui-form-label">字段:</label>
                <div class="layui-input-block">
                    <input type="text" name="table_field" value="" placeholder="" autocomplete="off" class="layui-input" lay-verify="required">
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-form-item">
                <label class="layui-form-label">字段名称:</label>
                <div class="layui-input-block">
                    <input type="text" name="table_title" value="" placeholder="" autocomplete="off" class="layui-input" lay-verify="required">
                </div>
            </div>
        </div>

        <div class="layui-row">
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="hidden" name="id">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
                </div>
            </div>
        </div>
    </form>

</div>
{include file="common/_footer_layui_256"}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
layui.use('form', function(){
    var form  = layui.form;
    //form初始值
    form.val("form-filter", {
        "id": "{$infodata.id}",
        "table_field": "{$infodata.table_field}",
        "table_title": "{$infodata.table_title}"
    })
    //监听提交
    form.on('submit(formDemo)', function(data1) {

        $.ajax({
            type : "POST",
            url  : "{:url('TableList/edit')}",
            data : $("#form-article").serialize(),
            success : function(data) {

                if (data.code ==200) {
                    parent.layer.msg("编辑完成");
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                    parent.layer.load();
                    parent.location.reload();
                } else {

                    layer.msg("编辑失败");
                }

            },
            error : function(e) {

                layer.msg("编辑失败");
            }
        });

        return false;
    });

    
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>